package cn.tedu.controller;

import cn.tedu.pojo.Car;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :Colin
 * @version 创建时间: 2021/7/14 14:52
 */
@RestController
@RequestMapping("car")
@CrossOrigin //解决跨域
public class CarController {
    @RequestMapping("get")
    public Car get() {
        Car car = new Car();
        car.setColor("红色");
        car.setId(11);
        car.setName("niubility");
        return car;
    }

    @RequestMapping("add")
    public Car add(Car car){
        System.out.println(car);
        return car;
    }
    @RequestMapping("add4/{x}/{y}/{z}/{a}/{b}")
    public void add4(@PathVariable Integer x,
                     @PathVariable String y,
                     @PathVariable String z,
                     @PathVariable String a,
                     @PathVariable Double b)
    {
        Car car = new Car(x,y,z,a,b);
        System.out.println(car);


    }
    @RequestMapping("add5/{x}")
    public void add5(@PathVariable Integer x)
    {

        System.out.println(x);


    }
}
